<template>
	<view>
		<view class="container">
			<view class="p30 m-hairline--bottom" @click="ticket()"><view class="fs30 col-3 m-arrow-right">开票信息</view></view>
			<!-- <view @click="clearPopOpen" class="p30 m-hairline--bottom"><view class="fs30 col-3 m-arrow-right">清空缓存</view></view> -->
			<view class="p30 m-hairline--bottom" @click="layout()"><view class="fs30 col-3 m-arrow-right">退出登录</view></view>
		</view>
		<!-- 弹窗 -->
		<uni-popup ref="clearPopup" type="center">
			<view class="clearPop tc" catchtouchmove="true">
				<image class="icon-warnning" src="/static/icon/icon_warnning.png" mode="aspectFit"></image>
				<view class="fs28 col-black">确定清理缓存 4.5M</view>
				<view class="foot-wrap flex-box m-hairline--top">
					<view @click="clearPopClose" class="btn flex-1 col-6 m-hairline--right">取消</view>
					<view class="btn flex-1 col-red">确定</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
export default {
	data() {
		return {};
	},
	onLoad() {
		// uni.getStorageInfo({
		// 	success: function (res) {
		// 		console.log(res.keys);
		// 		console.log(res.currentSize);
		// 		console.log(res.limitSize);
		// 	}
		// });
	},
	methods: {
		ticket(){
			if(!this.$user.getUserinfo(true)){
				return false;
			}
			uni.navigateTo({
				url: '../billing_info/billing_info'
			})
		},
		layout(){
			let that = this;
			uni.showModal({
				title: '提示',
				content: '确认退出登录',
				success: function (res) {
					if (res.confirm) {
						that.$user.logout();
						uni.showToast({
							title: '退出成功',
							icon: 'none'
						});
						setTimeout(function(){
							uni.navigateBack({
								delta:1
							})
						},1500)
					} else if (res.cancel) {
						//console.log('用户点击取消');
					}
				}
			});
		},
		clearPopOpen() {
			this.$refs.clearPopup.open();
		},
		clearPopClose() {
			this.$refs.clearPopup.close();
		}
	}
};
</script>

<style scoped>
.container {
	background: rgb(248, 248, 248);
}
.clearPop {
	padding: 50rpx 0 0;
	width: 520rpx;
	background: #ffffff;
	border-radius: 20rpx;
	overflow: hidden;
}
.clearPop .icon-warnning {
	margin: 0 auto 25rpx;
	display: block;
	width: 82rpx;
	height: 82rpx;
}
.clearPop .foot-wrap {
	margin-top: 55rpx;
}
.clearPop .btn {
	height: 90rpx;
	line-height: 90rpx;
}
</style>
